java.lang.OutOfMemoryError: Java heap space を debug する
jcmd
JDK に附屬してる
jcmdユーティリティ
jcmd
ScalaScala.iconなので sbt です…
code:heap_dump/jcmd.rb
#!/usr/bin/env ruby
require 'fileutils'
loop do
pid = %x(ps aux | grep 'sbt\.ForkMain' | awk '{print$2}').strip
dirname = %(hd-#{Time.now.to_i})
filename = File.join(Dir.pwd, dirname, "#{dirname}.hprof")
Dir.mkdir dirname
cmd = %(jcmd #{pid} GC.heap_dump -all #{filename})
puts cmd
system cmd
sleep 8
end
code:sh
cd heap_dump
./jcmd.rb
Eclipse Memory Analyzer Open Source Project | The Eclipse Foundation
mat.appを/Applicationsに入れる
macOS Catalina 向けに file access 權限が付與される
code:/Applications/mat.app/Contents/Eclipse/MemoryAnalyzer.ini
- -Xmx1024m
+ -Xmx8192m
How to do a Java/JVM heap dump in KubernetesKubernetes.icon